<template>
    <fieldset>
        <legend>产品列表</legend>
        <ul>
            <li v-for="item in msg" :key="item._productId"> 
                <!-- <router-link :to="{path:`/details/${item.productId}`}">
                {{ item.productName }}
                </router-link> -->
                <p @click="jump(item)">{{ item.productName }}</p>
            </li>
        </ul>
    </fieldset>
</template>

<script>
export default {
    data(){
        return{
            msg:[],
        }
    },
    mounted(){
        fetch("http://chst.vip:1234/api/getmoneyctrl")
        .then(body=>body.json())
        .then(res=>{
            console.log(res)
            this.msg = res.result
        })
    },
    methods:{
        jump(item){
            // console.log(item)
            // this.$router.push({path:"/details",query:{id:item.productId}})
            this.$router.push({path:`/details/${item.productId}`})
        }
    }
}
</script>

<style scoped>
   p{
    cursor: pointer;
    font-size: 30px;
    font-weight: 900;
   }
</style>
